<h3><?php echo $this->title?></h3>
<div style="color:red;"><?php echo $this->errMessage;?></div>
<div class="upload-image">
<form action="/admin/documentary/save" method="post" enctype="multipart/form-data">
    <table class="table table-bordered table-striped">
        <tbody>
             <tr>
                 <td>Name</td>
                 <td>
                     <input type="text" name="name" id="name" value="<?php echo $this->documentary['name'];?>">
                 </td>
             </tr>
             <tr>
                 <td>Author</td>
                 <td>
                     <input type="text" name="author" id="author" value="<?php echo $this->documentary['author'];?>">
                 </td>
             </tr>
              <tr>
                 <td>Short description</td>
                 <td>
                     <textarea type="text" name="short_description" id="short_description" cols="200" rows="5" style="width: 700px"><?php echo trim($this->documentary['short_description']);?></textarea>
                 </td>
             </tr>
              <tr>
                 <td>Content</td>
                 <td>
                     <textarea type="text" name="content" id="content" cols="200" rows="5" class="mceEditor">
                         <?php echo $this->documentary['content'];?>
                     </textarea>
                 </td>
             </tr>
              <tr>
                 <td>Image
                     <?php if($this->documentary['image']) {?>
                         <img src="<?php echo Utils_Global::get('staticUrl') . '/documentary/' . $this->documentary['hash_folder'] . '/' . $this->documentary['image']?>" alt="<?php echo $this->documentary['image']?>" width="50" height="50">
                     <?php }?>
                 </td>
                 <td>
                     <input type="file" name="file" id="file" accept="image/*" title="Chỉ chấp nhận các định dạng hình ảnh (png, jpg, jpge, gif)">
                 </td>
             </tr>
              <tr>
                 <td>File association</td>
                 <td>
                     <select name="file_associate" id="file_associate">
                         <?php foreach ($this->files as $file):?>
                             <option value="<?php echo $file['id']?>" <?php echo $this->documentary['file_id'] == $file['id']? 'selected="selected"':""?>><?php echo $file['name']?></option>
                         <?php endforeach;?>
                     </select>
                 </td>
             </tr>
             <tr>
                 <td>Order</td>
                 <td>
                     <input type="number" name="order" id="order" value="<?php echo $this->documentary['order']?>"/>
                 </td>
             </tr>
              <tr>
                 <td>New</td>
                 <td>
                     <input type="checkbox" name="new" id="new" <?php echo $this->documentary['new']?'checked="checked"':"";?>/>
                 </td>
             </tr>
             <tr>
                 <td>Active</td>
                 <td>
                     <input type="checkbox" name="active" id="active" <?php echo $this->documentary['active']?'checked="checked"':"";?>/>
                 </td>
             </tr>
             <tr>
                <td colspan="2">
                    <input type="submit" value="Save"/>
                    <a href="/admin/documentary/list">Cancel</a>
                </td> 
             </tr>
        </tbody>
      </table>
      <input type="hidden" value="<?php echo $this->id?>" name="id" id="id"/>
</form>
</div>
<script type="text/javascript">
tinymce.init({
	remove_script_host: false,
    relative_urls: false,
    // General options
    mode : "specific_textareas",
    editor_selector:'mceEditor',
    theme : "advanced",
    plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

    // Theme options
    theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
    theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
    theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
    theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_resizing : true,

    // Skin options
    skin : "o2k7",
    skin_variant : "silver",

    // Example content CSS (should be your site CSS)
    content_css : "css/example.css",

    // Drop lists for link/image/media/template dialogs
    template_external_list_url : "js/template_list.js",
    external_link_list_url : "js/link_list.js",
    external_image_list_url : "js/image_list.js",
    media_external_list_url : "js/media_list.js",
});

</script>